<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
<script src="../AngularJS/angular-1.5.0/angular.min.js"></script>
		<title></title>
	</head>
	<body ng-app="myapp">
		<div ng-controller="myctrl">
			<form name="myform" ng-submit="save()" >
				<!--angular js 自动校验-->
				<input name="username" type="text" ng-model="user.username"required/>
				<input name="password" type="password" ng-model="user.password" required/>
				<!--表单校验状态-->
				<input type="submit" ng-disabled="myform.$invalid" />
			</form>
		</div>
<script>
	var app = angular.module("myapp",[]);
	app.controller("myctrl",function($scope){
		$scope.user={
			username:'lxp',
			password:'password'
		}
		$scope.save=function(){
			alert("保存数据...")
		}
	});
	 
</script>
	</body>
</html>
